// src/api/speechToTextAPI.ts

import axios from "axios"; // 你也可以改用你已有的 request 封装

const speechToTextAPI = async (file: File) => {
    const form = new FormData();
    form.append("model", "FunAudioLLM/SenseVoiceSmall");
    form.append("file", file);
    form.append("response_format", "json"); // 改为json格式以获得结构化的响应

    return axios.post("https://api.siliconflow.cn/v1/audio/transcriptions", form, {
        headers: {
            Authorization: "Bearer sk-lghnjmlspvtlhfhnbamhymohfztxbzhmcylqujcgbviiecaz",
            // 不设置 Content-Type，axios 会自动处理 boundary
        },
    });
};

export default speechToTextAPI;